﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Management.Automation;
using System.Collections;
using System.Security;
using agsXMPP;

namespace PoshXmpp
{
    [Cmdlet(VerbsCommunications.Disconnect, "Chat")]
    public class DisconnectChatCommand : XmppCommandBase
    {

        #region Parameters
        [Parameter(Position = 0,
            Mandatory = true,
            HelpMessage = "Jabber Id to start chat to")]
        [Alias("JabberId")]
        [ValidateNotNullOrEmpty]
        public string ChatId { get; set; }

        [Parameter(Position = 1,
            Mandatory = true,
            HelpMessage = "Nickname to use")]
        [ValidateNotNullOrEmpty]
        public string Nickname { get; set; }
        #endregion

        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Jid Chat = new Jid(ChatId);
            Client.LeaveChat(Chat);
        }
    }
}
